using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._DeepLearning
{
    /// <summary>
    /// <para>Classify Pixels Using Deep Learning</para>
    /// <para>Runs a trained deep learning model on an input raster to produce a classified raster, with each valid pixel having an assigned class label.</para>
    /// <para>在输入栅格上运行经过训练的深度学习模型以生成分类栅格，每个有效像素都有一个分配的类标注。</para>
    /// </summary>    
    [DisplayName("Classify Pixels Using Deep Learning")]
    public class ClassifyPixelsUsingDeepLearning : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ClassifyPixelsUsingDeepLearning()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para>The input raster dataset to classify. The input can be a single raster or multiple rasters in a mosaic dataset, an image service, or a folder of images.</para>
        /// <para>要分类的输入栅格数据集。输入可以是镶嵌数据集中的单个栅格或多个栅格、影像服务或影像文件夹。</para>
        /// </param>
        /// <param name="_out_classified_raster">
        /// <para>Output Classified Raster</para>
        /// <para>The name of the classified raster or the mosaic dataset containing the classified rasters.</para>
        /// <para>分类栅格或包含分类栅格的镶嵌数据集的名称。</para>
        /// </param>
        /// <param name="_in_model_definition">
        /// <para>Model Definition</para>
        /// <para><xdoc>
        ///   <para>The Esri model definition parameter value can be an Esri model definition JSON file (.emd), a JSON string, or a deep learning model package (.dlpk). A JSON string is useful when this tool is used on the server so you can paste the JSON string rather than upload the .emd file. The .dlpk file must be stored locally.</para>
        ///   <para>It contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>Esri 模型定义参数值可以是 Esri 模型定义 JSON 文件 （.emd）、JSON 字符串或深度学习模型包 （.dlpk）。在服务器上使用此工具时，JSON 字符串非常有用，因此您可以粘贴 JSON 字符串，而不是上传 .emd 文件。.dlpk 文件必须存储在本地。</para>
        ///   <para>它包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// </xdoc></para>
        /// </param>
        public ClassifyPixelsUsingDeepLearning(object _in_raster, object _out_classified_raster, object _in_model_definition)
        {
            this._in_raster = _in_raster;
            this._out_classified_raster = _out_classified_raster;
            this._in_model_definition = _in_model_definition;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Classify Pixels Using Deep Learning";

        public override string CallName => "ia.ClassifyPixelsUsingDeepLearning";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "geographicTransformations", "gpuID", "outputCoordinateSystem", "parallelProcessingFactor", "processorType", "scratchWorkspace", "snapRaster", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _out_classified_raster, _in_model_definition, _arguments, _processing_mode.GetGPValue(), _out_classified_folder];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The input raster dataset to classify. The input can be a single raster or multiple rasters in a mosaic dataset, an image service, or a folder of images.</para>
        /// <para>要分类的输入栅格数据集。输入可以是镶嵌数据集中的单个栅格或多个栅格、影像服务或影像文件夹。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output Classified Raster</para>
        /// <para>The name of the classified raster or the mosaic dataset containing the classified rasters.</para>
        /// <para>分类栅格或包含分类栅格的镶嵌数据集的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classified Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_classified_raster { get; set; }


        /// <summary>
        /// <para>Model Definition</para>
        /// <para><xdoc>
        ///   <para>The Esri model definition parameter value can be an Esri model definition JSON file (.emd), a JSON string, or a deep learning model package (.dlpk). A JSON string is useful when this tool is used on the server so you can paste the JSON string rather than upload the .emd file. The .dlpk file must be stored locally.</para>
        ///   <para>It contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>Esri 模型定义参数值可以是 Esri 模型定义 JSON 文件 （.emd）、JSON 字符串或深度学习模型包 （.dlpk）。在服务器上使用此工具时，JSON 字符串非常有用，因此您可以粘贴 JSON 字符串，而不是上传 .emd 文件。.dlpk 文件必须存储在本地。</para>
        ///   <para>它包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Definition")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_model_definition { get; set; }


        /// <summary>
        /// <para>Arguments</para>
        /// <para>The function arguments are defined in the Python raster function class. This is where you list additional deep learning parameters and arguments for experiments and refinement, such as a confidence threshold for adjusting sensitivity. The names of the arguments are populated from reading the Python module.</para>
        /// <para>函数参数在 Python 栅格函数类中定义。在这里，您可以列出用于实验和优化的其他深度学习参数和参数，例如用于调整灵敏度的置信度阈值。参数的名称是通过读取 Python 模块来填充的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Arguments")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _arguments { get; set; } = null;


        /// <summary>
        /// <para>Processing Mode</para>
        /// <para><xdoc>
        ///   <para>Specifies how all raster items in a mosaic dataset or an image service will be processed. This parameter is applied when the input raster is a mosaic dataset or an image service.</para>
        ///   <bulletList>
        ///     <bullet_item>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</bullet_item><para/>
        ///     <bullet_item>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何处理镶嵌数据集或影像服务中的所有栅格项目。当输入栅格为镶嵌数据集或影像服务时，将应用此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Processing Mode")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _processing_mode_value _processing_mode { get; set; } = _processing_mode_value._PROCESS_AS_MOSAICKED_IMAGE;

        public enum _processing_mode_value
        {
            /// <summary>
            /// <para>Process as mosaicked image</para>
            /// <para>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</para>
            /// <para>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</para>
            /// </summary>
            [Description("Process as mosaicked image")]
            [GPEnumValue("PROCESS_AS_MOSAICKED_IMAGE")]
            _PROCESS_AS_MOSAICKED_IMAGE,

            /// <summary>
            /// <para>Process all raster items separately</para>
            /// <para>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</para>
            /// <para>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</para>
            /// </summary>
            [Description("Process all raster items separately")]
            [GPEnumValue("PROCESS_ITEMS_SEPARATELY")]
            _PROCESS_ITEMS_SEPARATELY,

        }

        /// <summary>
        /// <para>Output Folder</para>
        /// <para><xdoc>
        ///   <para>The folder where the output classified rasters will be stored. A mosaic dataset will be generated using the classified rasters in this folder.</para>
        ///   <para>This parameter is required when the input raster is a folder of images or a mosaic dataset in which all items are to be processed separately. The default is a folder in your project folder.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将存储输出分类栅格的文件夹。将使用此文件夹中的分类栅格生成镶嵌数据集。</para>
        ///   <para>当输入栅格是影像文件夹或镶嵌数据集时，所有项目都将单独处理，则此参数是必需的。默认值为项目文件夹中的文件夹。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Folder")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_classified_folder { get; set; } = null;


        public ClassifyPixelsUsingDeepLearning SetEnv(object cellSize = null, object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, object workspace = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, workspace: workspace);
            return this;
        }

    }

}